﻿using LDC_Shop_B.Models;
using System.Collections.Generic;

namespace LDC_Shop_B.Serives
{
    public interface IOrderService
    {
        /// <summary>
        /// 获取订单编号（年月日时分秒 + 随机数[0001-9999]） 保证订单编号唯一 
        /// </summary>
        string GetOrderNum();

        /// <summary>
        /// 创建订单和订单明细
        /// </summary>
        /// <param name="list"></param>
        /// <param name="userId"></param>
        void CreateOrder(List<CarGoods> list, int userId);
        /// <summary>
        /// 减少商品库存
        /// </summary>
        void DiffGoodStock(List<CarGoods> list);
        /// <summary>
        /// 检查库存 返回库存是否足够 如果不够 提示哪个商品库存不足
        /// </summary>
        /// <param name="list">购物车</param>
        /// <param name="err">返回不足商品信息</param>
        /// <returns>是否库存不足</returns>
        bool CheckGoodStock(List<CarGoods> list, out string err);

        /// <summary>
        /// 获取用户订单列表
        /// </summary>
        List<UserOrder> GetUserOrderList(int userId, int orderState, int pageIndex, int pageSize, out int total);
        /// <summary>
        /// 获取后台订单列表
        /// </summary>
        List<AdminOrder> GetAdminOrderList(int orderState, int pageIndex, int pageSize, out int total);

        /// <summary>
        /// 发货
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="shipCom"></param>
        /// <param name="shipNum"></param>
        /// <returns></returns>
        bool SendOrder(int orderId, string shipCom, string shipNum);
    }
}
